package OOday03;

/**
 * 引用数据类型
 */
public class RefArrayDemo {
    public static void main(String[] args) {
        Dog []dogs=new Dog[4];
        Chick[]chick=new Chick[4];
        Fish []fish=new Fish[4];
        dogs[0]=new Dog("大黄",1,"白色","骨头");
        dogs[1]=new Dog("小黑",2,"黑色","马铃薯");
        dogs[2]=new Dog("虎子",2,"黄色","鸡肉");
        dogs[3]=new Dog("飞虎",3,"黄色","骨头");

        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        chick[0]=new Chick("公鸡",1,"白色");
        chick[1]=new Chick("战斗机",2,"黑色");
        chick[2]=new Chick("F-22",2,"黄色");
        chick[3]=new Chick("飞鹰",3,"黄色");

        for (int i=0;i<chick.length;i++){
            System.out.println(chick[i].color);
            chick[i].drink();
        }
        fish[0]=new Fish("飞鱼",1,"白色");
        fish[1]=new Fish("海鲨",2,"黑色");
        fish[2]=new Fish("龙鲨",2,"黄色");
        fish[3]=new Fish("鱼雷",3,"黄色");
        for (int i=0;i<fish.length;i++){
            System.out.println(fish[i].age);
            fish[i].swim();
        }
    }
}
